package com.kele.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.kele.entity.Login;
import com.kele.entity.LoginVo;
import com.kele.mapper.LoginMapper;
import com.kele.service.LoginService;
import org.springframework.stereotype.Service;

/**
 * <p>
 *  服务实现类
 * </p>
 *
 * @author kele
 * @since 2022-01-08
 */
@Service
public class LoginServiceImpl extends ServiceImpl<LoginMapper, Login> implements LoginService {

    @Override
    public Login userLogin(LoginVo loginVo) {
        QueryWrapper qw =new QueryWrapper();
        qw.eq("name",loginVo.getName());
        qw.eq("password",loginVo.getPassword());
        return this.baseMapper.selectOne(qw);
    }

    @Override
    public int insertToken(String token, Long userId) {
        return this.baseMapper.insertToken(token, userId);
    }
}
